home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing;
-
- import com.sun.java.accessibility.Accessible;
- import com.sun.java.accessibility.AccessibleContext;
- import com.sun.java.accessibility.AccessibleState;
- import com.sun.java.swing.event.EventListenerList;
- import com.sun.java.swing.event.TreeExpansionEvent;
- import com.sun.java.swing.event.TreeExpansionListener;
- import com.sun.java.swing.event.TreeSelectionEvent;
- import com.sun.java.swing.event.TreeSelectionListener;
- import com.sun.java.swing.plaf.TreeUI;
- import com.sun.java.swing.tree.DefaultMutableTreeNode;
- import com.sun.java.swing.tree.DefaultTreeModel;
- import com.sun.java.swing.tree.DefaultTreeSelectionModel;
- import com.sun.java.swing.tree.TreeCellEditor;
- import com.sun.java.swing.tree.TreeCellRenderer;
- import com.sun.java.swing.tree.TreeModel;
- import com.sun.java.swing.tree.TreeNode;
- import com.sun.java.swing.tree.TreePath;
- import com.sun.java.swing.tree.TreeSelectionModel;
- import java.awt.AWTEvent;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.LayoutManager;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.InputEvent;
- import java.awt.event.MouseEvent;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.io.Serializable;
- import java.util.Hashtable;
- import java.util.Vector;
-
- public class JTree extends JComponent implements Scrollable, Accessible {
- protected transient TreeModel treeModel;
- protected transient TreeSelectionModel selectionModel;
- protected boolean rootVisible;
- protected transient TreeCellRenderer cellRenderer;
- protected int rowHeight;
- protected boolean showsRootHandles;
- protected TreeSelectionRedirector selectionRedirector;
- protected transient TreeCellEditor cellEditor;
- protected boolean editable;
- protected boolean largeModel;
- protected int visibleRowCount;
- protected boolean invokesStopCellEditing;
- public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
- public static final String TREE_MODEL_PROPERTY = "treeModel";
- public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
- public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
- public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
- public static final String CELL_EDITOR_PROPERTY = "cellEditor";
- public static final String EDITABLE_PROPERTY = "editable";
- public static final String LARGE_MODEL_PROPERTY = "largeModel";
- public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
- public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
- public static final String INVOKES_STOP_CELL_EDITING_PROPERTY = "messagesStopCellEditing";
- static Class class$com$sun$java$swing$event$TreeExpansionListener;
- static Class class$com$sun$java$swing$event$TreeSelectionListener;
-
- public JTree() {
- this(getDefaultTreeModel());
- }
-
- public JTree(Object[] value) {
- this(createTreeModel(value));
- this.setRootVisible(false);
- this.setShowsRootHandles(true);
- }
-
- public JTree(TreeModel newModel) {
- ((Container)this).setLayout((LayoutManager)null);
- this.rowHeight = 16;
- this.visibleRowCount = 20;
- this.rootVisible = true;
- this.selectionModel = new DefaultTreeSelectionModel();
- this.cellRenderer = null;
- this.updateUI();
- this.setModel(newModel);
- }
-
- public JTree(TreeNode root) {
- this(root, false);
- }
-
- public JTree(TreeNode root, boolean asksAllowsChildren) {
- this((TreeModel)(new DefaultTreeModel(root, asksAllowsChildren)));
- }
-
- public JTree(Hashtable value) {
- this(createTreeModel(value));
- this.setRootVisible(false);
- this.setShowsRootHandles(true);
- }
-
- public JTree(Vector value) {
- this(createTreeModel(value));
- this.setRootVisible(false);
- this.setShowsRootHandles(true);
- }
-
- public void addSelectionInterval(int index0, int index1) {
- TreePath[] paths = this.getPathBetweenRows(index0, index1);
- this.getSelectionModel().addSelectionPaths(paths);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void addSelectionPath(TreePath path) {
- this.getSelectionModel().addSelectionPath(path);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void addSelectionPaths(TreePath[] paths) {
- this.getSelectionModel().addSelectionPaths(paths);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void addSelectionRow(int row) {
- int[] rows = new int[]{row};
- this.addSelectionRows(rows);
- }
-
- public void addSelectionRows(int[] rows) {
- TreeUI ui = this.getUI();
- if (ui != null && rows != null) {
- int numRows = rows.length;
- TreePath[] paths = new TreePath[numRows];
-
- for(int counter = 0; counter < numRows; ++counter) {
- paths[counter] = ui.getPathForRow(rows[counter]);
- }
-
- this.addSelectionPaths(paths);
- }
-
- }
-
- public void addTreeExpansionListener(TreeExpansionListener tel) {
- EventListenerList var10000 = super.listenerList;
- Class var10001 = class$com$sun$java$swing$event$TreeExpansionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeExpansionListener");
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeExpansionListener = var10001;
- }
-
- var10000.add(var10001, tel);
- }
-
- public void addTreeSelectionListener(TreeSelectionListener tsl) {
- EventListenerList var10000 = super.listenerList;
- Class var10001 = class$com$sun$java$swing$event$TreeSelectionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeSelectionListener");
- } catch (ClassNotFoundException var3) {
- throw new NoClassDefFoundError(((Throwable)var3).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeSelectionListener = var10001;
- }
-
- var10000.add(var10001, tsl);
- var10000 = super.listenerList;
- var10001 = class$com$sun$java$swing$event$TreeSelectionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeSelectionListener");
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeSelectionListener = var10001;
- }
-
- if (var10000.getListenerCount(var10001) != 0 && this.selectionRedirector == null) {
- this.selectionRedirector = new TreeSelectionRedirector(this);
- this.selectionModel.addTreeSelectionListener(this.selectionRedirector);
- }
-
- }
-
- public void clearSelection() {
- this.getSelectionModel().clearSelection();
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void collapsePath(TreePath path) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.collapsePath(path);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
- }
-
- }
-
- public void collapseRow(int row) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.collapseRow(row);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
- }
-
- }
-
- public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
- return value != null ? value.toString() : "";
- }
-
- protected static TreeModel createTreeModel(Object value) {
- Object root;
- if (!(value instanceof Object[]) && !(value instanceof Hashtable) && !(value instanceof Vector)) {
- root = new DynamicUtilTreeNode("root", value);
- } else {
- root = new DefaultMutableTreeNode("root");
- com.sun.java.swing.JTree.DynamicUtilTreeNode.createChildren((DefaultMutableTreeNode)root, value);
- }
-
- return new DefaultTreeModel((TreeNode)root, false);
- }
-
- public void expandPath(TreePath path) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.expandPath(path);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
- }
-
- }
-
- public void expandRow(int row) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.expandRow(row);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
- }
-
- }
-
- public void fireTreeCollapsed(TreePath path) {
- Object[] listeners = super.listenerList.getListenerList();
- TreeExpansionEvent e = null;
-
- for(int i = listeners.length - 2; i >= 0; i -= 2) {
- Object var10000 = listeners[i];
- Class var10001 = class$com$sun$java$swing$event$TreeExpansionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeExpansionListener");
- } catch (ClassNotFoundException var5) {
- throw new NoClassDefFoundError(((Throwable)var5).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeExpansionListener = var10001;
- }
-
- if (var10000 == var10001) {
- if (e == null) {
- e = new TreeExpansionEvent(this, path);
- }
-
- ((TreeExpansionListener)listeners[i + 1]).treeCollapsed(e);
- }
- }
-
- }
-
- public void fireTreeExpanded(TreePath path) {
- Object[] listeners = super.listenerList.getListenerList();
- TreeExpansionEvent e = null;
-
- for(int i = listeners.length - 2; i >= 0; i -= 2) {
- Object var10000 = listeners[i];
- Class var10001 = class$com$sun$java$swing$event$TreeExpansionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeExpansionListener");
- } catch (ClassNotFoundException var5) {
- throw new NoClassDefFoundError(((Throwable)var5).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeExpansionListener = var10001;
- }
-
- if (var10000 == var10001) {
- if (e == null) {
- e = new TreeExpansionEvent(this, path);
- }
-
- ((TreeExpansionListener)listeners[i + 1]).treeExpanded(e);
- }
- }
-
- }
-
- protected void fireValueChanged(TreeSelectionEvent e) {
- Object[] listeners = super.listenerList.getListenerList();
-
- for(int i = listeners.length - 2; i >= 0; i -= 2) {
- Object var10000 = listeners[i];
- Class var10001 = class$com$sun$java$swing$event$TreeSelectionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeSelectionListener");
- } catch (ClassNotFoundException var4) {
- throw new NoClassDefFoundError(((Throwable)var4).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeSelectionListener = var10001;
- }
-
- if (var10000 == var10001) {
- ((TreeSelectionListener)listeners[i + 1]).valueChanged(e);
- }
- }
-
- }
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleJTree(this);
- }
-
- return super.accessibleContext;
- }
-
- public TreeCellEditor getCellEditor() {
- return this.cellEditor;
- }
-
- public TreeCellRenderer getCellRenderer() {
- return this.cellRenderer;
- }
-
- public TreePath getClosestPathForLocation(int x, int y) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getClosestPathForLocation(x, y) : null;
- }
-
- public int getClosestRowForLocation(int x, int y) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getClosestRowForLocation(x, y) : -1;
- }
-
- protected static TreeModel getDefaultTreeModel() {
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
- DefaultMutableTreeNode child = new DefaultMutableTreeNode("swing");
- root.add(child);
- DefaultMutableTreeNode parent = child;
- child = new DefaultMutableTreeNode("is");
- parent.add(child);
- parent = child;
- child = new DefaultMutableTreeNode("cool");
- parent.add(child);
- return new DefaultTreeModel(root);
- }
-
- public TreePath getEditingPath() {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getEditingPath() : null;
- }
-
- public boolean getInvokesStopCellEditing() {
- return this.invokesStopCellEditing;
- }
-
- public Object getLastSelectedPathComponent() {
- TreePath selPath = this.getSelectionModel().getSelectionPath();
- return selPath != null ? selPath.getLastPathComponent() : null;
- }
-
- public TreePath getLeadSelectionPath() {
- return this.getSelectionModel().getLeadSelectionPath();
- }
-
- public int getLeadSelectionRow() {
- return this.getSelectionModel().getLeadSelectionRow();
- }
-
- public int getMaxSelectionRow() {
- return this.getSelectionModel().getMaxSelectionRow();
- }
-
- public int getMinSelectionRow() {
- return this.getSelectionModel().getMinSelectionRow();
- }
-
- public TreeModel getModel() {
- return this.treeModel;
- }
-
- protected TreePath[] getPathBetweenRows(int index0, int index1) {
- TreeUI tree = this.getUI();
- int newMinIndex = Math.min(index0, index1);
- int newMaxIndex = Math.max(index0, index1);
- if (tree == null) {
- return null;
- } else {
- TreePath[] selection = new TreePath[newMaxIndex - newMinIndex + 1];
-
- for(int counter = newMinIndex; counter <= newMaxIndex; ++counter) {
- selection[counter - newMinIndex] = tree.getPathForRow(counter);
- }
-
- return selection;
- }
- }
-
- public Rectangle getPathBounds(TreePath path) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getPathBounds(path) : null;
- }
-
- public TreePath getPathForLocation(int x, int y) {
- TreePath closestPath = this.getClosestPathForLocation(x, y);
- if (closestPath != null) {
- Rectangle pathBounds = this.getPathBounds(closestPath);
- if (x >= pathBounds.x && x < pathBounds.x + pathBounds.width && y >= pathBounds.y && y < pathBounds.y + pathBounds.height) {
- return closestPath;
- }
- }
-
- return null;
- }
-
- public TreePath getPathForRow(int row) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getPathForRow(row) : null;
- }
-
- public Dimension getPreferredScrollableViewportSize() {
- int width = ((JComponent)this).getPreferredSize().width;
- int visRows = this.getVisibleRowCount();
- int height;
- if (this.isFixedRowHeight()) {
- height = visRows * this.getRowHeight();
- } else {
- TreeUI ui = this.getUI();
- if (ui != null && ui.getRowCount() > 0) {
- height = this.getRowBounds(0).height * visRows;
- } else {
- height = 16 * visRows;
- }
- }
-
- return new Dimension(width, height);
- }
-
- public Rectangle getRowBounds(int row) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getRowBounds(row) : null;
- }
-
- public int getRowCount() {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getRowCount() : 0;
- }
-
- public int getRowForLocation(int x, int y) {
- int closestRow = this.getClosestRowForLocation(x, y);
- if (closestRow != -1) {
- Rectangle rowBounds = this.getRowBounds(closestRow);
- if (x >= rowBounds.x && x < rowBounds.x + rowBounds.width && y >= rowBounds.y && y < rowBounds.y + rowBounds.height) {
- return closestRow;
- }
- }
-
- return -1;
- }
-
- public int getRowForPath(TreePath path) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.getRowForPath(path) : -1;
- }
-
- public int getRowHeight() {
- return this.rowHeight;
- }
-
- public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
- return orientation == 1 ? visibleRect.height : visibleRect.width;
- }
-
- public boolean getScrollableTracksViewportHeight() {
- return false;
- }
-
- public boolean getScrollableTracksViewportWidth() {
- return false;
- }
-
- public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
- if (orientation == 1) {
- int firstIndex = this.getClosestRowForLocation(0, visibleRect.y);
- if (firstIndex != -1) {
- Rectangle rowBounds = this.getRowBounds(firstIndex);
- if (rowBounds.y != visibleRect.y) {
- if (direction < 0) {
- return visibleRect.y - rowBounds.y;
- }
-
- return rowBounds.y + rowBounds.height - visibleRect.y;
- }
-
- if (direction >= 0) {
- return rowBounds.height;
- }
-
- if (firstIndex != 0) {
- rowBounds = this.getRowBounds(firstIndex - 1);
- return rowBounds.height;
- }
- }
-
- return 0;
- } else {
- return 4;
- }
- }
-
- public int getSelectionCount() {
- return this.selectionModel.getSelectionCount();
- }
-
- public TreeSelectionModel getSelectionModel() {
- return this.selectionModel;
- }
-
- public TreePath getSelectionPath() {
- return this.getSelectionModel().getSelectionPath();
- }
-
- public TreePath[] getSelectionPaths() {
- return this.getSelectionModel().getSelectionPaths();
- }
-
- public int[] getSelectionRows() {
- return this.getSelectionModel().getSelectionRows();
- }
-
- public boolean getShowsRootHandles() {
- return this.showsRootHandles;
- }
-
- public String getToolTipText(MouseEvent event) {
- if (event != null) {
- Point p = event.getPoint();
- int selRow = this.getRowForLocation(p.x, p.y);
- TreeCellRenderer r = this.getCellRenderer();
- if (selRow != -1 && r != null) {
- TreePath path = this.getPathForRow(selRow);
- Object lastPath = path.getLastPathComponent();
- Component rComponent = r.getTreeCellRendererComponent(this, lastPath, this.isRowSelected(selRow), this.isExpanded(selRow), this.getModel().isLeaf(lastPath), selRow, true);
- if (rComponent instanceof JComponent) {
- Rectangle pathBounds = this.getPathBounds(path);
- p.translate(-pathBounds.x, -pathBounds.y);
- MouseEvent newEvent = new MouseEvent(rComponent, ((AWTEvent)event).getID(), ((InputEvent)event).getWhen(), ((InputEvent)event).getModifiers(), p.x, p.y, event.getClickCount(), event.isPopupTrigger());
- return ((JComponent)rComponent).getToolTipText(newEvent);
- }
- }
- }
-
- return null;
- }
-
- public TreeUI getUI() {
- return (TreeUI)super.ui;
- }
-
- public String getUIClassID() {
- return "TreeUI";
- }
-
- public int getVisibleRowCount() {
- return this.visibleRowCount;
- }
-
- public boolean isCollapsed(int row) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.isCollapsed(row) : false;
- }
-
- public boolean isCollapsed(TreePath path) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.isCollapsed(path) : false;
- }
-
- public boolean isEditable() {
- return this.editable;
- }
-
- public boolean isEditing() {
- TreeUI tree = this.getUI();
- return tree != null ? tree.isEditing() : false;
- }
-
- public boolean isExpanded(int row) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.isExpanded(row) : false;
- }
-
- public boolean isExpanded(TreePath path) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.isExpanded(path) : false;
- }
-
- public boolean isFixedRowHeight() {
- return this.rowHeight > 0;
- }
-
- public boolean isLargeModel() {
- return this.largeModel;
- }
-
- public boolean isOpaque() {
- return true;
- }
-
- public boolean isPathEditable(TreePath path) {
- return this.isEditable();
- }
-
- public boolean isPathSelected(TreePath path) {
- return this.getSelectionModel().isPathSelected(path);
- }
-
- public boolean isRootVisible() {
- return this.rootVisible;
- }
-
- public boolean isRowSelected(int row) {
- return this.getSelectionModel().isRowSelected(row);
- }
-
- public boolean isSelectionEmpty() {
- return this.getSelectionModel().isSelectionEmpty();
- }
-
- public boolean isVisible(TreePath path) {
- TreeUI tree = this.getUI();
- return tree != null ? tree.isVisible(path) : false;
- }
-
- public void makeVisible(TreePath path) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.makeVisible(path);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
- }
-
- }
-
- private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
- s.defaultReadObject();
- Vector values = (Vector)s.readObject();
- int indexCounter = 0;
- int maxCounter = values.size();
- if (indexCounter < maxCounter && values.elementAt(indexCounter).equals("cellRenderer")) {
- ++indexCounter;
- this.cellRenderer = (TreeCellRenderer)values.elementAt(indexCounter);
- ++indexCounter;
- }
-
- if (indexCounter < maxCounter && values.elementAt(indexCounter).equals("cellEditor")) {
- ++indexCounter;
- this.cellEditor = (TreeCellEditor)values.elementAt(indexCounter);
- ++indexCounter;
- }
-
- if (indexCounter < maxCounter && values.elementAt(indexCounter).equals("treeModel")) {
- ++indexCounter;
- this.treeModel = (TreeModel)values.elementAt(indexCounter);
- ++indexCounter;
- }
-
- if (indexCounter < maxCounter && values.elementAt(indexCounter).equals("selectionModel")) {
- ++indexCounter;
- this.selectionModel = (TreeSelectionModel)values.elementAt(indexCounter);
- ++indexCounter;
- }
-
- }
-
- public void removeSelectionInterval(int index0, int index1) {
- TreePath[] paths = this.getPathBetweenRows(index0, index1);
- this.getSelectionModel().removeSelectionPaths(paths);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void removeSelectionPath(TreePath path) {
- this.getSelectionModel().removeSelectionPath(path);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void removeSelectionPaths(TreePath[] paths) {
- this.getSelectionModel().removeSelectionPaths(paths);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void removeSelectionRow(int row) {
- int[] rows = new int[]{row};
- this.removeSelectionRows(rows);
- }
-
- public void removeSelectionRows(int[] rows) {
- TreeUI ui = this.getUI();
- if (ui != null && rows != null) {
- int numRows = rows.length;
- TreePath[] paths = new TreePath[numRows];
-
- for(int counter = 0; counter < numRows; ++counter) {
- paths[counter] = ui.getPathForRow(rows[counter]);
- }
-
- this.removeSelectionPaths(paths);
- }
-
- }
-
- public void removeTreeExpansionListener(TreeExpansionListener tel) {
- EventListenerList var10000 = super.listenerList;
- Class var10001 = class$com$sun$java$swing$event$TreeExpansionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeExpansionListener");
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeExpansionListener = var10001;
- }
-
- var10000.remove(var10001, tel);
- }
-
- public void removeTreeSelectionListener(TreeSelectionListener tsl) {
- EventListenerList var10000 = super.listenerList;
- Class var10001 = class$com$sun$java$swing$event$TreeSelectionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeSelectionListener");
- } catch (ClassNotFoundException var3) {
- throw new NoClassDefFoundError(((Throwable)var3).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeSelectionListener = var10001;
- }
-
- var10000.remove(var10001, tsl);
- var10000 = super.listenerList;
- var10001 = class$com$sun$java$swing$event$TreeSelectionListener;
- if (var10001 == null) {
- try {
- var10001 = Class.forName("com.sun.java.swing.event.TreeSelectionListener");
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
-
- class$com$sun$java$swing$event$TreeSelectionListener = var10001;
- }
-
- if (var10000.getListenerCount(var10001) == 0 && this.selectionRedirector != null) {
- this.selectionModel.removeTreeSelectionListener(this.selectionRedirector);
- this.selectionRedirector = null;
- }
-
- }
-
- public void scrollPathToVisible(TreePath path) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.scrollPathToVisible(path);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
- }
-
- }
-
- public void scrollRowToVisible(int row) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.scrollRowToVisible(row);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
- }
-
- }
-
- public void setCellEditor(TreeCellEditor cellEditor) {
- TreeCellEditor oldEditor = this.cellEditor;
- this.cellEditor = cellEditor;
- ((JComponent)this).firePropertyChange("cellEditor", oldEditor, cellEditor);
- ((Container)this).invalidate();
- }
-
- public void setCellRenderer(TreeCellRenderer x) {
- TreeCellRenderer oldValue = this.cellRenderer;
- this.cellRenderer = x;
- ((JComponent)this).firePropertyChange("cellRenderer", oldValue, this.cellRenderer);
- ((Container)this).invalidate();
- }
-
- public void setEditable(boolean flag) {
- boolean oldValue = this.editable;
- this.editable = flag;
- ((JComponent)this).firePropertyChange("editable", oldValue, flag);
- if (super.accessibleContext != null) {
- super.accessibleContext.firePropertyChange("AccessibleState", oldValue ? AccessibleState.EDITABLE : null, flag ? AccessibleState.EDITABLE : null);
- }
-
- }
-
- public void setInvokesStopCellEditing(boolean newValue) {
- boolean oldValue = this.invokesStopCellEditing;
- this.invokesStopCellEditing = newValue;
- ((JComponent)this).firePropertyChange("messagesStopCellEditing", oldValue, newValue);
- }
-
- public void setLargeModel(boolean newValue) {
- boolean oldValue = this.largeModel;
- this.largeModel = newValue;
- ((JComponent)this).firePropertyChange("largeModel", oldValue, newValue);
- }
-
- public void setModel(TreeModel newModel) {
- TreeModel oldModel = this.treeModel;
- this.treeModel = newModel;
- ((JComponent)this).firePropertyChange("treeModel", oldModel, this.treeModel);
- ((Container)this).invalidate();
- }
-
- public void setRootVisible(boolean rootVisible) {
- boolean oldValue = this.rootVisible;
- this.rootVisible = rootVisible;
- ((JComponent)this).firePropertyChange("rootVisible", oldValue, this.rootVisible);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
-
- }
-
- public void setRowHeight(int rowHeight) {
- int oldValue = this.rowHeight;
- this.rowHeight = rowHeight;
- ((JComponent)this).firePropertyChange("rowHeight", oldValue, this.rowHeight);
- ((Container)this).invalidate();
- }
-
- public void setSelectionInterval(int index0, int index1) {
- TreePath[] paths = this.getPathBetweenRows(index0, index1);
- this.getSelectionModel().setSelectionPaths(paths);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void setSelectionModel(TreeSelectionModel selectionModel) {
- if (selectionModel == null) {
- selectionModel = com.sun.java.swing.JTree.EmptySelectionModel.sharedInstance();
- }
-
- TreeSelectionModel oldValue = this.selectionModel;
- this.selectionModel = selectionModel;
- ((JComponent)this).firePropertyChange("selectionModel", oldValue, this.selectionModel);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void setSelectionPath(TreePath path) {
- this.getSelectionModel().setSelectionPath(path);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void setSelectionPaths(TreePath[] paths) {
- this.getSelectionModel().setSelectionPaths(paths);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireSelectionPropertyChange();
- }
-
- }
-
- public void setSelectionRow(int row) {
- int[] rows = new int[]{row};
- this.setSelectionRows(rows);
- }
-
- public void setSelectionRows(int[] rows) {
- TreeUI ui = this.getUI();
- if (ui != null && rows != null) {
- int numRows = rows.length;
- TreePath[] paths = new TreePath[numRows];
-
- for(int counter = 0; counter < numRows; ++counter) {
- paths[counter] = ui.getPathForRow(rows[counter]);
- }
-
- this.setSelectionPaths(paths);
- }
-
- }
-
- public void setShowsRootHandles(boolean newValue) {
- boolean oldValue = this.showsRootHandles;
- this.showsRootHandles = newValue;
- ((JComponent)this).firePropertyChange("showsRootHandles", oldValue, this.showsRootHandles);
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
-
- ((Container)this).invalidate();
- }
-
- public void setUI(TreeUI ui) {
- if ((TreeUI)super.ui != ui) {
- super.setUI(ui);
- ((Component)this).repaint();
- }
-
- }
-
- public void setVisibleRowCount(int newCount) {
- int oldCount = this.visibleRowCount;
- this.visibleRowCount = newCount;
- ((JComponent)this).firePropertyChange("visibleRowCount", oldCount, this.visibleRowCount);
- ((Container)this).invalidate();
- if (super.accessibleContext != null) {
- ((AccessibleJTree)super.accessibleContext).fireVisibleDataPropertyChange();
- }
-
- }
-
- public void startEditingAtPath(TreePath path) {
- TreeUI tree = this.getUI();
- if (tree != null) {
- tree.startEditingAtPath(path);
- }
-
- }
-
- public boolean stopEditing() {
- TreeUI tree = this.getUI();
- return tree != null ? tree.stopEditing() : false;
- }
-
- public void treeDidChange() {
- ((JComponent)this).revalidate();
- ((Component)this).repaint();
- }
-
- public void updateUI() {
- this.setUI((TreeUI)UIManager.getUI(this));
- ((Container)this).invalidate();
- }
-
- private void writeObject(ObjectOutputStream s) throws IOException {
- Vector values = new Vector();
- s.defaultWriteObject();
- if (this.cellRenderer != null && this.cellRenderer instanceof Serializable) {
- values.addElement("cellRenderer");
- values.addElement(this.cellRenderer);
- }
-
- if (this.cellEditor != null && this.cellEditor instanceof Serializable) {
- values.addElement("cellEditor");
- values.addElement(this.cellEditor);
- }
-
- if (this.treeModel != null && this.treeModel instanceof Serializable) {
- values.addElement("treeModel");
- values.addElement(this.treeModel);
- }
-
- if (this.selectionModel != null && this.selectionModel instanceof Serializable) {
- values.addElement("selectionModel");
- values.addElement(this.selectionModel);
- }
-
- s.writeObject(values);
- }
- }
-